import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class TowServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int money = 50;
        PrintWriter out = response.getWriter();
//        out.write(money);
//        此时浏览器上显示的结果并不为50, 而为2
//        原因:
//        out.writer(), 可以将字符, 字符串, ASCII码写入到响应体中
//        当参数为int时, 会将其认为是ASCII码, 在浏览器显示的时候就是打印ASCII码对应的字符
//        ASCII码为50时候对应的字符为2
//        解决:
//        使用out.print();
        out.print(money);
    }
}
